/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "sle_seek_hdi.h"
#include "sle_hal_errcode.h"
#include "sle_unit_test_log.h"

static SleSeekHdiCallbacks *g_seekHdiTestCbs;

SleHdiErrorCode StartSeekHdiTest(void)
{
    g_seekHdiTestCbs->OnSeekStartCb(SLE_HDI_ERRCODE_SUCC);
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode StopSeekHdiTest(void)
{
    g_seekHdiTestCbs->OnSeekStopCb(SLE_HDI_ERRCODE_SUCC);
    SleSeekResult seekResultData;
    g_seekHdiTestCbs->OnSeekResultCb(&seekResultData);
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode SetSeekParamHdiTest(SleSeekParam *param)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(param != NULL, SLE_HDI_ERRCODE_FAIL, "SetSeekParamHdiTest");
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode RegisterSeeCbksHdi(SleSeekHdiCallbacks *callbacks)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(callbacks != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "RegisterSeeCbksHdi");
    g_seekHdiTestCbs = callbacks;
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode GetSleSeekHdiOpts(SleSeekHdiOpts *seekOpts)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(seekOpts != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "GetSleSeekHdiOpts");
    seekOpts->startSeek = StartSeekHdiTest;
    seekOpts->stopSeek = StopSeekHdiTest;
    seekOpts->setSeekParam = SetSeekParamHdiTest;
    seekOpts->registerSeeCbks = RegisterSeeCbksHdi;
    return SLE_HDI_ERRCODE_SUCC;
}